﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Consultant.Models
{
    public class DataManager
    {
        private ProjectDataContext _datacontext;
        public DataManager(string connectionString)
        {
            _datacontext = new ProjectDataContext(connectionString);
        }

        private OperatorRepository _operatorRepository;
        public OperatorRepository Operator
        {
            get
            {
                if (_operatorRepository == null)
                    _operatorRepository= new OperatorRepository(_datacontext);
                return _operatorRepository;
            }
        }

        private UserRepository _userRepository;
        public UserRepository User
        {
            get
            {
                if (_userRepository == null)
                    _userRepository = new UserRepository(_datacontext);
                return _userRepository;
            }
        }

        private AdminRepository _adminRepository;
        public AdminRepository Admin
        {
            get
            {
                if (_adminRepository == null)
                    _adminRepository = new AdminRepository(_datacontext);
                return _adminRepository;
            }
        }
    }
}